(function(ns, $, undefined)
{
  var utilsNs = window.utils;

  function clickMeEditBtn()
  {
    //alert("Me Edit Button");
    $.ajax({
      url: '/me',
      data: { subject: 'About Me', content: 'blah' },
      dataType: 'json',
      type: 'POST',
      success: function(data, textStatus, jqXHR)
      {
        if(0 == data.length) alert('No data');
      },
      error: function(jqXHR, textStatus, errorThrown)
      {
        alert(textStatus + ': ' + errorThrown);
      }
    });
  }

  function clickSiteEditBtn()
  {
    alert("Site Edit Button");
  }

  ns.onload = function()
  {
    ns.data.getAboutMe();

    if(true == window.utils.data.isAdmin())
    {
      $('#meHead').after(utilsNs.gui.buildEditButtonHTML("meEditBtn"));
      $('#meEditBtn').click(clickMeEditBtn);
      $('#siteHead').after(utilsNs.gui.buildEditButtonHTML("siteEditBtn"));
      $('#siteEditBtn').click(clickSiteEditBtn);
    }
  }
}(window.home = window.home || {}, jQuery));

window.onload = window.home.onload;